<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../Vue全家桶_stu/03_依赖包/vue.js"></script>
    <!-- v-show 是控制元素的display属性 适合用于频繁切换的元素  -->
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        #root {
            width: 240px;
            height: 300px;
            margin: 50px auto;
            border: 1px solid #000;
        }

        #root .header {
            display: flex;
            /* justify-content: space-between; */
            border-bottom: 1px solid #666;
        }

        #root .header li {
            flex:1;
            text-align: center;
            border-radius: 5px;
        }

        #root .header li:hover {
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div id="root">
        <ul class="header">
            <li @mouseover=" handler ">酒店</li>
            <li @mouseover=" handler ">机票</li>
            <li @mouseover=" handler ">话费</li>
        </ul>
        <ul class="main">
            <li v-show=" select === '酒店' ">酒店对应的tab</li>
            <li v-show=" select === '机票' ">机票对应的tab</li>
            <li v-show=" select === '话费' ">话费对应的tab</li>
        </ul>
    </div>
    <script>
        const vm = new Vue({
            el: '#root',
            data: {
                select: '酒店'
            },
            methods: {
                handler(event) {
                    // 通过select属性来控制元素的显示与隐藏
                    this.select = event.target.innerText
                }
            }
        })
    </script>
</body>

</html>